import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/guide/api-plugin.html#universal-hooks
const examplePlugin = () => {
  let config

  return {
    name: 'read-config',

    configResolved(resolvedConfig) {
      // store the resolved config
      config = resolvedConfig
    },
    buildEnd(error?: Error){
        console.log("buildEnd")
    },
    closeBundle(){
        console.log('closeBundle')
    },
    // use stored config in other hooks
    transform(code, id) {
      if (config.command === 'serve') {
        // dev: plugin invoked by dev server
      } else {
        // build: plugin invoked by Rollup
      }
    }
  }
}

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(),examplePlugin()],
  server:{
      // host:"192.168.10.231"
       host:"192.168.1.102"
      //host:"localhost"
  }})
